package com.order_system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.order_system.constants.Code;
import com.order_system.entity.Product;
import com.order_system.entity.ProductType;
import com.order_system.entity.ResModel;
import com.order_system.entity.ShopCar;
import com.order_system.mapper.ProductTypeMapper;
import com.order_system.mapper.ShopCarMapper;
import com.order_system.service.ProductService;
import com.order_system.service.ProductTypeService;
import com.order_system.service.ShopCarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 李阳
 * @since 2023-01-06
 */
@Service
public class ShopCarServiceImpl extends ServiceImpl<ShopCarMapper, ShopCar> implements ShopCarService {


    @Override
    public ResModel add(List<Integer> ids) {
        for (Integer id : ids) {
            ShopCar shopCar = new ShopCar();
            shopCar.setCount(1);
            shopCar.setProductId(id);
            save(shopCar);
        }
        return ResModel.success(Code.SUCCESS,true);
    }
}
